<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <template>
      <el-table ref="singleTable" :data="powerData" highlight-current-row border>
        <el-table-column type="index" width="50">
        </el-table-column>
        <el-table-column property="authName" label="路径" width="120">
        </el-table-column>
        <el-table-column property="path" label="权限" width="120">
        </el-table-column>
        <el-table-column label="层级" width="200">
          <template slot-scope="scope">
            <span>{{scope.row.level | levelForMat}}</span>
          </template>
        </el-table-column>
      </el-table>
    </template>
  </div>
</template>

<script>
import { getPowerList } from '@/api/index.js'
export default {
  data () {
    return {
      powerData: []
    }
  },
  filters: {
    levelForMat (level) {
      if (level === '0') {
        return '一级'
      } else if (level === '1') {
        return '二级'
      } else if (level === '2') {
        return '三级'
      }
    }
  },
  mounted () {
    getPowerList('list').then(res => {
      console.log(res)
      this.powerData = res.data
    })
  },
  methods: {
  }
}
</script>

<style scoped>
</style>
